package com.hbnu.system.controller;

import com.hbnu.system.core.base.Rest;
import com.hbnu.system.model.QualificationDTO.PatentQualificationDTO;
import com.hbnu.system.model.entity.Patent_Qualification;
import com.hbnu.system.service.IPatentQualificationSerivce;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/patentqulification")
@Api(tags = "专利量化模块")
public class PatentQualificationController {
    @Autowired
    private IPatentQualificationSerivce iPatentQualificationSerivce;

    @ApiOperation("专利量化添加")
    @PostMapping("/addPatentQualification")
    public Rest<Boolean> addPatentQualification(@RequestBody PatentQualificationDTO patent_qualificationDTO){
        boolean add = iPatentQualificationSerivce.addPatent_Qualification(patent_qualificationDTO);
        return add ? Rest.success() : Rest.failed();
    }

    @ApiOperation("专利量化删除")
    @GetMapping("/deletePatentQulification")
    public Rest<Boolean> deletePatentQulification(String PatentQualificationID){
        boolean delete = iPatentQualificationSerivce.deletePatent_Qualification(PatentQualificationID);
        return delete ? Rest.success() : Rest.failed();
    }

    @ApiOperation("专利量化查看")
    @GetMapping("/getPatentQulification")
    public Rest<List<Patent_Qualification>> getPatentQulification(String PatentID){
        List<Patent_Qualification> onePatent_qualification = iPatentQualificationSerivce.getOnePatent_Qualification(PatentID);
        return Rest.success(onePatent_qualification);
    }

    @ApiOperation("校级管理员修改量化分数")
    @PostMapping("/upPatentScore")
    public Rest<Boolean> upPatentScore(@RequestBody Patent_Qualification patent_qualification ){
        boolean update = iPatentQualificationSerivce.upPatentScore(patent_qualification);
        return update ? Rest.success() : Rest.failed();
    }


}
